<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
    	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    	<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>订单列表</title>
		<link href="${pageContext.request.contextPath }/css/bootstrap.min.css" rel="stylesheet">
		<script src="${pageContext.request.contextPath }/js/jquery-1.11.1.js"></script>
		<script src="${pageContext.request.contextPath }/js/bootstrap.min.js"></script>
		<script type="text/javascript">
			function showDesc(oid){
				$.get("${pageContext.request.contextPath }/adminOrder_findOrderItemByOid.action?oid="+oid, function(data){
					$(".desc_view").html();
					$(".desc_view").hide();
					$("#desc"+oid).html(data).show();
				}, "html");
			}
		</script>
	</head>
	<body>
		<div class="row">
			<div class="col-md-12">
				<div class="panel panel-default">
					<div class="panel-heading">订单列表</div>
					<div class="panel-body">
						<table class="table table-striped table-hover table-bordered">
							<thead>
								<tr>
									<th>#</th>
									<th>订单编号</th>
									<td>订单金额</td>
									<td>收货人</td>
									<td>联系电话</td>
									<td>收货地址</td>
									<td>订单状态</td>
									<td>订单详情</td>
								</tr>
							</thead>
							<tbody>
								<s:iterator var="o" value="pageBean.list" status="st">
								<tr>
									<td><s:property value="#st.count"/></td>
									<td>
										<s:property value="#o.oid"/>
									</td>
									<td><s:property value="#o.total"/></td>
									<td><s:property value="#o.name"/></td>
									<td><s:property value="#o.phone"/></td>
									<td><s:property value="#o.addr"/></td>
									<td>
										<s:if test="#o.state==0">
											未付款
										</s:if>
										<s:if test="#o.state==1">
											<a href="${pageContext.request.contextPath }/adminOrder_updateState.action?oid=<s:property value="#o.oid"/>"><font color="red">发货</font></a>
										</s:if>
										<s:if test="#o.state==2">
											等待确认收货
										</s:if>
										<s:if test="#o.state==3">
											订单结束
										</s:if>
									</td>
									<td>
										<a href="#" onclick="showDesc(<s:property value="#o.oid"/>)"><span class="glyphicon glyphicon-list"></span></a>
										<div id="desc<s:property value="#o.oid"/>" class="desc_view" style="display: none;"></div>
<%-- 										<button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-sm">Small modal</button>

										<div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
										  <div class="modal-dialog modal-sm" role="document">
										    <div id="modal<s:property value="#o.oid"/>" class="modal-content">
												<table width="100%">
												<s:iterator var="item" value="#o.orderitems">
													<tr>
														<td><img width="40" height="45" src="${ pageContext.request.contextPath }/<s:property value="#item.product.image"/>"></img></td>
													<td><s:property value="#item.count"/></td>
													<td><s:property value="#item.subtotal"/></td>
													</tr>
												</s:iterator>
												</table>
										    </div>
										  </div>
										</div> --%>
									</td>
								</tr>
								</s:iterator>
							</tbody>
						</table>
					</div>
				</div>
			</div>
		</div>
		<nav aria-label="Page navigation" class="pull-right">
		  <ul class="pagination" style="margin-top: 5px;">
		  		<s:if test="pageBean.page != 1">
				<li>
				  <a href="${pageContext.request.contextPath }/adminOrder_findAllWithPage?page=<s:property value="pageBean.page-1"/>" aria-label="Previous">
					<span aria-hidden="true">上一页</span>
				  </a>
				</li>
				</s:if>
				<s:iterator var="i" begin="1" end="pageBean.totalPage">
					<s:if test="pageBean.page != #i">
						<li><a href="${pageContext.request.contextPath }/adminOrder_findAllWithPage?page=<s:property value="#i"/>"><s:property value="#i"/></a></li>
					</s:if>
					<s:else>
						<li class="active"><a href="#"><s:property value="#i"/></a></li>
					</s:else>
				</s:iterator>
				<s:if test="pageBean.page != pageBean.totalPage">
				<li>
				  <a href="${pageContext.request.contextPath }/adminOrder_findAllWithPage?page=<s:property value="pageBean.page+1"/>" aria-label="Next">
						<span aria-hidden="true">下一页</span>
				  </a>
				</li>
				</s:if>
		  </ul>
		</nav>
	</body>
</html>


